package com.lyubia.shop.portal.config;

import com.lyubia.shop.portal.interceptor.PortalLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class PortalConfig implements WebMvcConfigurer {

    @Resource
    private PortalLoginInterceptor portalLoginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(portalLoginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/css/**","/images/**","/js/**")
                .excludePathPatterns("/toLogin")
                .excludePathPatterns("/login")
                .excludePathPatterns("/logout");

    }
}
